package org.example.struct.array;

/**
 * @author liyishan
 * @date 2023/8/23 13:55
 * @apiNote
 */

public class Test01566ContainsPattern {
    public static void main(String[] args) {
        int[] arr = {1,2,4,4,4,4};
        boolean flag = test(arr,1,3);
        System.out.println(flag);
    }

    public static boolean test(int[] arr, int m, int k) {
        int n = arr.length;
        for (int l = 0; l <= n-m*k; l++) {
            int offset;
            for (offset = 0; offset < m * k; offset++) {
                if (arr[l + offset] != arr[l + offset % m]) {
                    break;
                }
            }
            if (offset == m * k) {
                return true;
            }
        }
        return false;
    }
}
